package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sc.nft.enums.task.TaskTypeEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.TaskPlanRecord;
import com.sc.nft.mapper.TaskPlanRecordMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * 任务进度记录表(sc_task_plan_record)数据DAO
 *
 * @author 张翔宇
 * @since 2023-03-29 11:14:52
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class TaskPlanRecordDao extends ServiceImpl<TaskPlanRecordMapper, TaskPlanRecord> {

    //根据关联类型和Id查询
    public int selectByLinkId(TaskTypeEnum linkType,Long linkId) {
        LambdaQueryWrapper<TaskPlanRecord> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TaskPlanRecord::getLinkType, linkType);
        queryWrapper.eq(TaskPlanRecord::getLinkId, linkId);
        return this.count(queryWrapper);
    }
}